Skip to content

Conversation

@lemorage
Copy link
Contributor

@lemorage lemorage commented May 7, 2025

Previously, in our implementations of yaml serialization, the serialize_tuple_variant and serialize_struct_variant methods only serialized the data within the variant. They don't handle the variant's name.

fn serialize_tuple_variant(
self,
_name: &'static str,
_variant_index: u32,
_variant: &'static str,
len: usize,
) -> Result<Self::SerializeTupleVariant, Self::Error> {
Ok(SeqSerializer {
vec: Vec::with_capacity(len),
})
}

fn serialize_struct_variant(
self,
_name: &'static str,
_variant_index: u32,
_variant: &'static str,
len: usize,
) -> Result<Self::SerializeStructVariant, Self::Error> {
self.serialize_map(Some(len))
}

This PR modifies them to store variant name when serialized, closes #443.

@badmonster0 badmonster0 merged commit b1a2939 into cocoindex-io:main May 7, 2025
6 checks passed
@badmonster0
Copy link
Member

Thanks for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Keep Variant Name in YAML Serialization

2 participants